package com.company;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Administrator
 * @date 2021/11/14
 * @description: HJ18 识别有效的IP地址和掩码并进行分类统计
 */
public class HJ18识别有效的IP地址和掩码并进行分类统计 {
    public static void main(String[] args) throws IOException {

        BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int A = 0, B = 0, C = 0, D = 0, E = 0, F = 0, G = 0;

        while ((str = buff.readLine()) != null) {
            String[] s = str.split("~");
            String[] ss1 = s[0].split("\\.");
            String[] s1 = s[1].split("\\.");
            if (ss1[0].equals("0") || ss1[0].equals("127")) {
                continue;
            }

            if (s[1].length() < 4 || s[0].length() < 4) {
                F++;
                continue;
            }
            StringBuilder sbu = new StringBuilder();

            long result = 0;
            for (int i = 0; i < s1.length; i++) {
                result = result << 8 | (long) Integer.parseInt(s1[i]);
            }
            if (result <= 0 || (((result ^ 0XFFFFFFFFL) + 1) | result) != result || result >= 0XFFFFFFFFL) {
                F++;
                continue;
            }


            if (ss1[0].equals("") || Integer.parseInt(ss1[0]) < 1 || Integer.parseInt(ss1[0]) > 255) {
                F++;
                continue;
            }


            boolean flag = false;
            for (int i = 1; i < ss1.length; i++) {
                if (ss1[i].equals("") || Integer.parseInt(ss1[i]) < 0 || Integer.parseInt(ss1[i]) > 255
                                || Integer.parseInt(s1[i]) < 0 || Integer.parseInt(s1[i]) > 255) {
                    F++;
                    flag = true;
                    break;
                }
            }

            if (flag) {
                continue;
            }

            if ((Integer.parseInt(ss1[0]) == 10)
                            || (Integer.parseInt(ss1[0]) == 172 && Integer.parseInt(ss1[1]) >= 16
                                            && Integer.parseInt(ss1[1]) <= 31)
                            || (Integer.parseInt(ss1[0]) == 192 && Integer.parseInt(ss1[1]) == 168)) {
                G++;
            }
            if (Integer.parseInt(ss1[0]) >= 1 && Integer.parseInt(ss1[0]) <= 126) {
                A++;
                continue;
            }
            if (Integer.parseInt(ss1[0]) >= 128 && Integer.parseInt(ss1[0]) <= 191) {
                B++;
                continue;
            }
            if (Integer.parseInt(ss1[0]) >= 192 && Integer.parseInt(ss1[0]) <= 223) {
                C++;
                continue;
            }
            if (Integer.parseInt(ss1[0]) >= 224 && Integer.parseInt(ss1[0]) <= 239) {
                D++;
                continue;
            }
            if (Integer.parseInt(ss1[0]) >= 240 && Integer.parseInt(ss1[0]) <= 255) {
                E++;
                continue;
            }
        }

        System.out.print(A + " " + B + " " + C + " " + D + " " + E + " " + F + " " + G);

    }
}

